uniform sampler2D source;

const float blurSize = 1.0/512.0; // I've chosen this size because this will result in that every step will be one pixel wide if the RTScene texture is of size 512x512
 
void main(void)
{
   vec4 sum = vec4(0.0);
   
   float t = gl_TexCoord[0].s;
   float s = gl_TexCoord[0].t;
 
   // blur in y (vertical)
   // take nine samples, with the distance blurSize between them
   sum += texture2D(source, vec2(t - 4.0*blurSize, s)) * 0.05;
   sum += texture2D(source, vec2(t - 3.0*blurSize, s)) * 0.09;
   sum += texture2D(source, vec2(t - 2.0*blurSize, s)) * 0.12;
   sum += texture2D(source, vec2(t - blurSize, s)) * 0.15;
   sum += texture2D(source, vec2(t, s)) * 0.16;
   sum += texture2D(source, vec2(t + blurSize, s)) * 0.15;
   sum += texture2D(source, vec2(t + 2.0*blurSize, s)) * 0.12;
   sum += texture2D(source, vec2(t + 3.0*blurSize, s)) * 0.09;
   sum += texture2D(source, vec2(t + 4.0*blurSize, s)) * 0.05;
 
   gl_FragColor = sum;
}
